﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MonitoringPlanSite.Master" AutoEventWireup="true" 
    CodeBehind="New_Data.aspx.cs" Inherits="Amkeni_Monitoring_Plan.New_Data" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<%@ Register Assembly="CustomDropDownList" Namespace="CustomDropDownList" TagPrefix="ddl" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <%--<script type="text/javascript">
        function Validate_Indicator(sender, args) {
            var oi = document.getElementById("<%= IndicatorList.ClientID %> ").value;
            var pi = document.getElementById("<%= ProcessIndicatorTextBox.ClientID %>").value;
            args.IsValid = (oi.value != "N/A") || (pi.value != "");
        }
    </script>--%>

    <style type="text/css">
    /*This is used to design the modal popup dialogue box*/
        .modalBackground
            {
                background-color: Black;
                filter: alpha(opacity=90);
                opacity: 0.8;
            }
        .modalPopup
            {
                background-color: #FFFFFF;
                border-width: 3px;
                border-style: solid;
                border-color: black;
                padding-top: 10px;
                padding-left: 10px;
                width: 1200px;
                height: 560px;
            }
    </style>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <%--<script>
        function Validate_Indicator(sender, args) {
            var oi = document.getElementById("<%= IndicatorList.ClientID %> ").value;
            var pi = document.getElementById("<%= ProcessIndicatorTextBox.ClientID %>").value;
            args.IsValid = (oi.value != "N/A") || (pi.value != "");
        }
    </script>--%>
    <asp:EntityDataSource ID="ThematicAreaDataSource" runat="server" ConnectionString="name=Amkeni_DatabaseEntities" 
        DefaultContainerName="Amkeni_DatabaseEntities" EnableFlattening="False" 
        EntitySetName="programme_outcome" Select="it.[outcome_id], it.[thematic_area]">
    </asp:EntityDataSource>

    <asp:EntityDataSource ID="FrequencyDataSource" runat="server" ConnectionString="name=Amkeni_DatabaseEntities" 
        DefaultContainerName="Amkeni_DatabaseEntities" EnableFlattening="False" 
        EntitySetName="report_period" Select="it.[report_period_id], it.[period]"></asp:EntityDataSource>
    
    <asp:EntityDataSource ID="OutcomeDataSource" runat="server" ConnectionString="name=Amkeni_DatabaseEntities" 
        DefaultContainerName="Amkeni_DatabaseEntities" EnableFlattening="False" 
        EntitySetName="programme_outcome" Select="it.[outcome_id]"></asp:EntityDataSource>

    <asp:EntityDataSource ID="RFPDataSource" runat="server" ConnectionString="name=Amkeni_DatabaseEntities" 
        DefaultContainerName="Amkeni_DatabaseEntities" EnableFlattening="False" 
        EntitySetName="RFPs" Select="it.[RFP_id], it.[RFP_name]"></asp:EntityDataSource>

    <asp:EntityDataSource ID="YearDataSource" runat="server" ConnectionString="name=Amkeni_DatabaseEntities" 
        DefaultContainerName="Amkeni_DatabaseEntities" EnableFlattening="False" EntitySetName="years"
         Select="it.[year_id], it.[year1]"></asp:EntityDataSource>

    <asp:Table ID="Table1" runat="server" GridLines="Both" CssClass="NewGrid">
        <%--<asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="Label1" runat="server" Text="Thematic Area"></asp:Label>
            </asp:TableCell>
            <asp:TableCell>
                <asp:DropDownList ID="ThematicAreaList" runat="server" 
                    DataSourceID="ThematicAreaDataSource" DataTextField="thematic_area" 
                    DataValueField="outcome_id" AppendDataBoundItems="true">
                    <asp:ListItem Selected="True" Text="Select A thematic area" Value="N/A" />
                </asp:DropDownList>
                &nbsp;&nbsp;
                <asp:RequiredFieldValidator ID="V1" runat="server" 
                    ErrorMessage="*" ForeColor="Red" ControlToValidate="ThematicAreaList"
                    InitialValue="N/A" ValidationGroup="plan"></asp:RequiredFieldValidator>
            </asp:TableCell>
        </asp:TableRow>--%>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="Label8" runat="server" Text="Call For Proposal"></asp:Label>
            </asp:TableCell>
            <asp:TableCell>
                <asp:DropDownList ID="RFPList" runat="server" DataSourceID="RFPDataSource" 
                    DataTextField="RFP_name" DataValueField="RFP_id" AutoPostBack="true"
                    OnSelectedIndexChanged="RFPList_SelectedIndexChanged" AppendDataBoundItems="true">
                    <asp:ListItem Selected="True" Text="Select a Call" Value="0" />
                </asp:DropDownList>
                &nbsp;&nbsp;
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" ForeColor="Red"
                    ControlToValidate="RFPList" InitialValue="N/A" ValidationGroup="plan" SetFocusOnError="true"></asp:RequiredFieldValidator>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="Label2" runat="server" Text="Implementing Partner"></asp:Label>
            </asp:TableCell>
            <asp:TableCell>
                <ddl:CustomDropDownList ID="IPList" runat="server" 
                    DataTextField="abbreviation" DataValueField="ip_id" OnDataBound="IPList_DataBound"
                    AppendDataBoundItems="false">
                    <asp:ListItem Selected="True" Text="N/A" Value="0" Enabled="true" />
                </ddl:CustomDropDownList>
                &nbsp;&nbsp;
                <asp:RequiredFieldValidator ID="V2" runat="server" ErrorMessage="*" ForeColor="Red"
                    ControlToValidate="IPList" InitialValue="N/A" ValidationGroup="plan" SetFocusOnError="true"></asp:RequiredFieldValidator>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="Label4" runat="server" Text="Activity"></asp:Label>
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="ActivityTextBox" runat="server" TextMode="MultiLine" CssClass="MText" Width="50%"></asp:TextBox>
                &nbsp;&nbsp;
                <asp:RequiredFieldValidator ID="V5" runat="server" ErrorMessage="*" ForeColor="Red"
                    ControlToValidate="ActivityTextBox" ValidationGroup="plan" SetFocusOnError="true"></asp:RequiredFieldValidator>
            </asp:TableCell>
        </asp:TableRow>
        
        <%--<asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="Label8" runat="server" Text="Baseline"></asp:Label>
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="BaselineTextBox" runat="server"></asp:TextBox>
                &nbsp;&nbsp;
                <asp:RequiredFieldValidator ID="V7" runat="server" ErrorMessage="*" ForeColor="Red"
                    ControlToValidate="BaselineTextBox" ValidationGroup="plan"></asp:RequiredFieldValidator>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="Label9" runat="server" Text="Target 2018"></asp:Label>
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="TargetTextBox" runat="server"></asp:TextBox>
                &nbsp;&nbsp;
                <asp:RequiredFieldValidator ID="V8" runat="server" ErrorMessage="*" ForeColor="Red"
                    ControlToValidate="TargetTextBox" ValidationGroup="plan"></asp:RequiredFieldValidator>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="Label10" runat="server" Text="Means Of Verification"></asp:Label>
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="VerificationTextBox" runat="server"></asp:TextBox>
                &nbsp;&nbsp;
                <asp:RequiredFieldValidator ID="V9" runat="server" ErrorMessage="*" ForeColor="Red"
                    ControlToValidate="VerificationTextBox" ValidationGroup="plan"></asp:RequiredFieldValidator>
            </asp:TableCell>
        </asp:TableRow>--%>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="Label11" runat="server" Text="Amkeni Programme Analyst"></asp:Label>
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="ProgrammeOfficerTextBox" runat="server" Width="50%"></asp:TextBox>
                &nbsp;&nbsp;
                <asp:RequiredFieldValidator ID="V10" runat="server" ErrorMessage="*" ForeColor="Red"
                    ControlToValidate="ProgrammeOfficerTextBox" ValidationGroup="plan" SetFocusOnError="true"></asp:RequiredFieldValidator>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="Label12" runat="server" Text="IP Responsible Officer"></asp:Label>
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="IPOfficerTextBox" runat="server" Width="50%"></asp:TextBox>
                &nbsp;&nbsp;
                <asp:RequiredFieldValidator ID="V11" runat="server" ErrorMessage="*" ForeColor="Red"
                    ControlToValidate="IPOfficerTextBox" ValidationGroup="plan" SetFocusOnError="true"></asp:RequiredFieldValidator>
            </asp:TableCell>
        </asp:TableRow>
        <%--<asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="Label13" runat="server" Text="Data Source"></asp:Label>
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="DataSourceTextBox" runat="server"></asp:TextBox>
                &nbsp; &nbsp
                <asp:RequiredFieldValidator ID="V12" runat="server" ErrorMessage="*" ForeColor="Red"
                    ControlToValidate="DataSourceTextBox" ValidationGroup="plan"></asp:RequiredFieldValidator>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="Label14" runat="server" Text="Method Of Collection"></asp:Label>
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="MethodOfCollectionTextBox" runat="server"></asp:TextBox>
                &nbsp;&nbsp;
                <asp:RequiredFieldValidator ID="V13" runat="server" ErrorMessage="*" ForeColor="Red"
                    ControlToValidate="MethodOfCollectionTextBox" ValidationGroup="plan">
                </asp:RequiredFieldValidator>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="Label15" runat="server" Text="Collection Tools"></asp:Label>
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="CollectionToolsTextBox" runat="server"></asp:TextBox>
                &nbsp;&nbsp;
                <asp:RequiredFieldValidator ID="V14" runat="server" ErrorMessage="*" ForeColor="Red"
                    ControlToValidate="CollectionToolsTextBox" ValidationGroup="plan"></asp:RequiredFieldValidator>
            </asp:TableCell>
        </asp:TableRow>--%>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="Label18" runat="server" Text="Year"></asp:Label>
            </asp:TableCell>
            <asp:TableCell>
                <asp:DropDownList ID="YearList" runat="server" DataSourceID="YearDataSource" 
                    DataTextField="year1" DataValueField="year_id"></asp:DropDownList>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="Label6" runat="server" Text="Frequency Of Collection"></asp:Label>
            </asp:TableCell>
            <asp:TableCell>
                <asp:CheckBoxList ID="FrequencyCheckBoxList" runat="server" DataSourceID="FrequencyDataSource" 
                    DataTextField="period" DataValueField="report_period_id"></asp:CheckBoxList>
                <%--&nbsp;&nbsp;
                <asp:RequiredFieldValidator ID="V15" runat="server" ErrorMessage="*" ForeColor="Red"
                    ControlToValidate="FrequencyCheckBoxList" ValidationGroup="plan"></asp:RequiredFieldValidator>--%>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="Label16" runat="server" Text="Resource Required**Amkeni"></asp:Label>
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="ResourceTextBox" runat="server" Width="50%"></asp:TextBox>
                &nbsp;&nbsp;
                <asp:RequiredFieldValidator ID="V16" runat="server" ErrorMessage="*" ForeColor="Red"
                    ControlToValidate="ResourceTextBox" ValidationGroup="plan" SetFocusOnError="true"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="REV1" runat="server" ForeColor="Red" ControlToValidate="ResourceTextBox" 
                    ValidationGroup="plan" SetFocusOnError="true"
                    ErrorMessage="Please enter a proper currency value"
                    ValidationExpression="^[0-9]+(\.[0-9]{1,2})?$"></asp:RegularExpressionValidator>
            </asp:TableCell>
        </asp:TableRow>
        <%--<asp:TableRow>
            <asp:TableCell>
                <asp:Label ID="Label17" runat="server" Text="Assumptions and Risks"></asp:Label>
            </asp:TableCell>
            <asp:TableCell>
                <asp:TextBox ID="AssumptionsTextBox" runat="server"></asp:TextBox>
                &nbsp;&nbsp;
                <asp:RequiredFieldValidator ID="V17" runat="server" ErrorMessage="*" ForeColor="Red"
                    ControlToValidate="AssumptionsTextBox" ValidationGroup="plan"></asp:RequiredFieldValidator>
            </asp:TableCell>
        </asp:TableRow>--%>
        <asp:TableRow>
            <asp:TableCell></asp:TableCell>
            <asp:TableCell>
                <asp:Button ID="AddIndicatorBtn" runat="server" Text="Save and Add Indicator" OnClick="AddIndicatorBtn_Click"  ValidationGroup="plan" />
                <asp:Button ID="CancelActivityBtn" runat="server" Text="Cancel" OnClick="CancelActivityBtn_Click" />
            </asp:TableCell>
        </asp:TableRow>

        <%------------------------------------EDIT FROM HERE-------------------------------------------------%>

    </asp:Table>

    <!-- ModalPopupExtender -->
    <asp:HiddenField ID="popupfield" runat="server" />

    <asp:ModalPopupExtender ID="mp1" runat="server" CancelControlID="CancelBtn"
        PopupControlID="Panel1" TargetControlID="popupfield" BackgroundCssClass="modalBackground">
    </asp:ModalPopupExtender>
    <asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" align="center" style="display:none">
        <asp:UpdatePanel ID="up1" runat="server">
            <ContentTemplate>
                
            </ContentTemplate>
        </asp:UpdatePanel>
    </asp:Panel>
    <!-- ModalPopupExtender -->

    <asp:HiddenField ID="IndicatorValue" runat="server" />
</asp:Content>
